//
// Created by 11510 on 2024/7/3.
//
#include <iostream>
#include <thread>
#include <memory>
using namespace std;

class A{
public:
    int _a;
    A(int a):_a(a){}
    void foo(shared_ptr<A> pa){
        cout << pa->_a;
    }
};

int main() {
    shared_ptr<A> pa = make_shared<A>(999);
    thread t(&A::foo, pa, pa);

    t.join();
    return 0;
}